package cn.elwy.rcp.ui.composite;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

public class SVNBrowserComposite extends Composite {
  private Table table;

  /**
   * Create the composite.
   * 
   * @param parent
   * @param style
   */
  public SVNBrowserComposite(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout(5, false));

    Label lblUrl = new Label(this, SWT.NONE);
    lblUrl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblUrl.setText("URL：");

    Combo combo = new Combo(this, SWT.NONE);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnUp = new Button(this, SWT.NONE);
    btnUp.setText("UP");

    Label lblRevision = new Label(this, SWT.NONE);
    lblRevision.setText("Revision：");

    Button button = new Button(this, SWT.NONE);
    GridData gd_button = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_button.widthHint = 80;
    gd_button.minimumWidth = 50;
    button.setLayoutData(gd_button);
    button.setText("5");

    SashForm sashForm = new SashForm(this, SWT.NONE);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));

    Tree tree = new Tree(sashForm, SWT.BORDER);
    TreeItem trtmNewTreeitem = new TreeItem(tree, SWT.NONE);
    trtmNewTreeitem.setText("New TreeItem");

    TreeItem trtmNewTreeitem_1 = new TreeItem(trtmNewTreeitem, SWT.NONE);
    trtmNewTreeitem_1.setText("New TreeItem");
    trtmNewTreeitem.setExpanded(true);

    TableViewer tableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
    table = tableViewer.getTable();
    table.setHeaderVisible(true);
    sashForm.setWeights(new int[] { 230, 600 });
    new Label(this, SWT.NONE);
    new Label(this, SWT.NONE);
    new Label(this, SWT.NONE);

    Button btnOk = new Button(this, SWT.NONE);
    btnOk.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    btnOk.setText("OK");

    Button btnNewButton = new Button(this, SWT.NONE);
    btnNewButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    btnNewButton.setText("Cancle");

  }

  @Override
  protected void checkSubclass() {
    // Disable the check that prevents subclassing of SWT components
  }
}
